<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title" class="form-control" data-rule="required" name="row[title]" type="text">
        </div>
    </div>
    <input id="c-type" class="form-control" name="row[type]" type="hidden" value="seckill">
    <!--<div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-type" class="form-control" name="row[type]" type="text" value="seckill">
        </div>
    </div>-->

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">活动时间:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="row row-between">
                <div class="col-xs-6">
                    <input id="c-starttime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss"
                           data-use-current="true" data-rule="required" name="row[starttime]" type="text"
                           value="{:date('Y-m-d H:i:s')}">
                </div>
                <div class="col-xs-6">
                    <input id="c-endtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss"
                           data-use-current="true" data-rule="required" name="row[endtime]" type="text"
                           value="{:date('Y-m-d H:i:s')}">
                </div>
            </div>
        </div>
    </div>
    <!--<div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">每人限购件数:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-limit" class="form-control" step="1" name="rules[limit]" placeholder="设为0则不做限制"
                       type="number" value="">
                <span class="input-group-addon">件</span>
            </div>
        </div>
    </div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">活动说明:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
        </div>
    </div>
    <div id="app" v-cloak>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">活动商品:</label>
            <div class="col-xs-12 col-sm-8">
                <button class="btn btn-info wanl-link" @click="goodsLink" type="button"><i class="fa fa-bars"></i> 选择
                </button>
            </div>
        </div>
        <div class="form-group" v-if="goods_ids.length >0">
            <label class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-8">
                <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                       data-operate-del="1"
                       width="100%">

                    <thead>
                    <tr>
                        <th style="text-align: center; vertical-align: middle; " data-field="id">
                            <div class="th-inner ">ID</div>
                            <div class="fht-cell"></div>
                        </th>
                        <th style="text-align: center; vertical-align: middle; " data-field="id">
                            <div class="th-inner ">商品信息</div>
                            <div class="fht-cell"></div>
                        </th>
                        <th style="text-align: center; vertical-align: middle; " data-field="shop.shopname">
                            <div class="th-inner ">操作</div>
                            <div class="fht-cell"></div>
                        </th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr v-for="(item,index) in goods" :key="index">
                        <td style="text-align: center; vertical-align: middle; ">
                            ID:{{item.id}}
                        </td>
                        <td style="text-align: center; vertical-align: middle; ">

                            {{item.title}}
                            <img class="img-sm img-center" :src="item.image"/>
                        </td>
                        <td style="text-align: center; vertical-align: middle; ">
                            <a href="javascript:;" class="btn btn-xs btn-warning" data-toggle="tooltip" title="设置"
                               @click="setSku(index,item.id)" v-if="item.activity_sku"><i class="fa fa-pencil"></i>重新设置</a>
                            <a href="javascript:;" class="btn btn-xs btn-success" data-toggle="tooltip" title="设置"
                               @click="setSku(index,item.id)" v-else><i class="fa fa-pencil"></i>设置</a>
                            <a href="javascript:;" class="btn btn-xs btn-danger" data-toggle="tooltip" title="移除"
                               @click="remove(index)"><i class="fa fa-trash"></i></a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>


        <input id="c-goods_ids" class="form-control" name="row[goods_ids]" type="hidden" :value="goods_ids_input">
        <input id="c-goods_sku" class="form-control" name="row[goods_sku]" type="hidden" :value="goods_sku">
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
